package com.mjlf.messagepack;

import org.msgpack.MessagePack;
import org.msgpack.template.Templates;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName MessagePackTest
 * @auther mjlf
 * @Date 2019/9/23 16:53
 * @Description message Pack 测试
 *
 * 使用messagePack 进行序列化与反序列化
 */
public class MessagePackTest {

    public static void main(String[] args) throws IOException {
        List<String> src = new ArrayList<>();
        src.add("msgpack");
        src.add("kumofs");
        src.add("viver");

        MessagePack msgpack = new MessagePack();

        byte[] raw = msgpack.write(src);

        List<String> dst = msgpack.read(raw, Templates.tList(Templates.TString));
        System.out.println(dst);
    }
}
